import confApi from "@/api/declaration/confApi"
import httpRequest from "@/config/axios/httpRequest"
import { ConfigModel } from "@/models/confs/ConfigModel"




// 查询参数列表
export const getConfigPage = (params: PageParam) => {
  return httpRequest.get(confApi.GetConfigPage, {
    params
  })
}

// 查询参数详情
export const getConfig = (id: number) => {
  return httpRequest.get(confApi.GetConfig, {
    params: {
      id
    }
  })
}

// 根据参数键名查询参数值
export const getConfigKey = (configKey: string) => {
  return httpRequest.get(confApi.GetConfigKey, {
    params: {
      configKey
    }
  })
}

// 新增参数
export const createConfig = (data: ConfigModel) => {
  return httpRequest.post(confApi.CreateConfig, data)
}

// 修改参数
export const updateConfig = (data: ConfigModel) => {
  return httpRequest.put(confApi.UpdateConfig, data)
}

// 删除参数
export const deleteConfig = (id: number) => {
  return httpRequest.delete(confApi.DeleteConfig, {
    params: {
      id
    }
  })
}

// 导出参数
export const exportConfig = (params) => {
  return httpRequest.download(confApi.ExportConfig, params)
}
